<?php

class m_debug {
		
/*------------------------------------------------------------------------------------------------------*/	
		/**
		* Version mejorada de print_r
		* @input anything
		* @return HTML String
		* @author  MadPitbull
		*/
		public function print_r($var) {
			echo '<div style="border: 1px solid red; background-color: #ffe0dd;"><pre>';
			print_r($var);
			echo '</pre></div>';
		}
		
		
/*------------------------------------------------------------------------------------------------------*/	
		/**
		* Usada para debuggear los elementos/variables
		* recibidos desde un formulario.
		* @input void
		* @return HTML String
		* @author  MadPitbull
		*/
		
	    public function form()
	    {
			echo '<div style="border: 1px solid red; background-color: #ffe0dd;"><pre>';
			print <<< HERE
		<table border = "1" cellpadding="2" cellspacing="2" >
		<thead>
			<tr bgcolor="#f65">
			  <th>Campo</th>
			  <th>Valor</th>
			</tr>
		</thead>
HERE;
		        foreach ($_REQUEST as $campo => $valor) {
		            print <<< HERE
		  <tbody>
			  <tr>
				<td>$campo</td>
				<td>$valor</td>
			  </tr>
		  </tbody>
HERE;
				} // end foreach
			print "</table>\n";
			echo '</pre></div>';
	
	    }
		
/*------------------------------------------------------------------------------------------------------*/		
	/*
	* JavaScript AlertBox
	* @input string
	* @return HTML String
	* @author  MadPitbull
	*/
	public function alert($var) {
		echo "<script>alert('".$var."');</script>";
	}
/*------------------------------------------------------------------------------------------------------*/	

	/**
	* Shows all the methods of the given class
	* @input string
	* @return HTML String
	* @author  MadPitbull
	*/
	public function classMethods($class) {
		
		$metodos = get_class_methods($class);
		echo '<div style="border: 1px solid red; background-color: #ffe0dd;"><pre>';
		echo '<b>Los metodos de la clase '.$class.' ('. count($metodos) .') :</b><br />';
		
		foreach ($metodos as $metodo) {
			print $metodo.'<br />';
		}
		echo '</pre></div>';
	}
/*------------------------------------------------------------------------------------------------------*/	
	/**
	* Shows all public variables/properties of the given class
	* @input string
	* @return HTML String
	* @author  MadPitbull
	*/
	public function defaultClassProperties($class) {
		$properties = get_class_vars($class);
		echo '<div style="border: 1px solid red; background-color: #ffe0dd;"><pre>';
		echo '<b>Los variables/propiedades inicializadas por defecto de la clase '.$class.' ('. count($properties) .') :</b><br />';
		
		foreach ($properties as $property=>$value) {
			print $property. ' == '. $value .'<br />';
		}
		echo '</pre></div>';
	}
/*------------------------------------------------------------------------------------------------------*/	
	/**
	* Shows all objects variables/properties	
	* @input object
	* @return HTML String
	* @author  MadPitbull
	*/
	public function objectVars($object) {
		$vars = get_object_vars($object);
		echo '<div style="border: 1px solid red; background-color: #ffe0dd;"><pre>';
		echo '<b>Los variables/propiedades inicializadas del objeto ('. count($$object) .') :</b><br />';
		foreach ($vars as $var=>$value) {
			echo $var . ' == ' . $value . '<br />';
		}
		echo '</pre></div>';
	}
/*------------------------------------------------------------------------------------------------------*/	
	
}



?>